package com.yh.controller;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yh.bean.Schedule;
import com.yh.service.impl.ScheduleService;

@Controller
public class ScheduleOperate {

	@Autowired
	private ScheduleService schs;
	
	//添加日程
	@RequestMapping("/addschedule")
	
	public String addSchedule(Schedule sch,Model model){
		System.out.println(sch);
		int i=schs.addSchedule(sch);
		model.addAttribute("result", i);
		return "schedule";
	}
	
	//查询某一天的日程
	@RequestMapping("/queryschedule")
	@ResponseBody
	public List<Schedule> querySchedule(Schedule schedule_day){
		List<Schedule> schelist=schs.querySchedule(schedule_day);
		System.out.println("查询结果"+schelist);
		return schelist;
	}
}
